﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using WEBapp001.Domain;
using WEBapp001.Helper;
using WEBapp001.Interface;

namespace WebApiV2.Api.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class TestController : ControllerBase
    {
        private readonly IRespository<Student> Studentrespository;
        private readonly IRespository<Collge> CollegeRespository;
        public TestController(IRespository<Student> _Studentrespository, IRespository<Collge> _Collegerespository)
        {
            Studentrespository = _Studentrespository;
            CollegeRespository = _Collegerespository;
        }

        public string Get()
        {
            var res = Studentrespository.Table.ToList();


            CollegeRespository.Insert(new Collge
            {
                CollgeName = "医疗班",
                DeanName = "纲手"
            });

            return JsonHelper.SerializeObject(res);
        }
    }
}